package com.oragraph.gui;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JTabbedPane;

public class MainFrame extends JFrame {
	
	public static MainFrame singleton;
	
	public JTabbedPane _tabPane;
	
	public MainFrame(String title) {
		super(title);
		singleton=this;
		
		_createMenu();
		
		_tabPane=new JTabbedPane();
		
		this.getContentPane().setLayout(new BorderLayout());
		this.getContentPane().add(_tabPane, BorderLayout.CENTER);
		
	}
	
	private void _createMenu() {
		
		JMenu fileMenu = new JMenu("File");
		
        fileMenu.add(new AbstractAction("New project") {
            public void actionPerformed(ActionEvent e) {
            	// TODO
            }});
        
        fileMenu.add(new AbstractAction("Save project") {
            public void actionPerformed(ActionEvent e) {
            	// TODO
            }});
        
        fileMenu.add(new AbstractAction("Project properties") {
            public void actionPerformed(ActionEvent e) {
            	// TODO
            }});

        fileMenu.addSeparator();
        
        fileMenu.add(new AbstractAction("Create tab") {
            public void actionPerformed(ActionEvent e) {
            	NewTabDialog ntd=new NewTabDialog();
            	ntd.setVisible(true);
            }});
        
        fileMenu.add(new AbstractAction("Delete tab") {
            public void actionPerformed(ActionEvent e) {
            	// TODO
            }});
        
        fileMenu.addSeparator();
        
        fileMenu.add(new AbstractAction("Export tab") {
            public void actionPerformed(ActionEvent e) {
            	// TODO
            }});
        
        fileMenu.add(new AbstractAction("Print tab") {
            public void actionPerformed(ActionEvent e) {
            	// TODO
            }});
        
        fileMenu.addSeparator();
        
        fileMenu.add(new AbstractAction("Exit") {
            public void actionPerformed(ActionEvent e) {
            	// TODO
            }});

        JMenuBar menuBar = new JMenuBar();
        menuBar.add(fileMenu);
        this.setJMenuBar(menuBar);
	}

}
